home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Online / SpeakFreely / src / blowfish / Makefile.uni < prev    next >
Makefile  |  2000-05-18  |  4KB  |  161 lines

  1. # Targets
  2. # make          - twidle the options yourself :-)
  3. # make cc       - standard cc options
  4. # make gcc      - standard gcc options
  5. # make x86-elf  - linux-elf etc
  6. # make x86-out  - linux-a.out, FreeBSD etc
  7. # make x86-solaris
  8. # make x86-bdsi
  9.  
  10. # use BF_PTR2 for intel boxes,
  11. # BF_PTR for sparc and MIPS/SGI
  12. # use nothing for Alpha and HP.
  13.  
  14. # There are 3 possible performance options, experiment :-)
  15. OPTS= -DBF_PTR  # usr for sparc and MIPS/SGI
  16. #OPTS= -DBF_PTR2 # use for pentium
  17. #OPTS=         # use for pentium pro, Alpha and HP
  18.  
  19. MAKE=make -f Makefile
  20. #CC=cc
  21. #CFLAG= -O
  22.  
  23. CC=gcc
  24. #CFLAG= -O4 -funroll-loops -fomit-frame-pointer
  25. CFLAG= -O3 -fomit-frame-pointer
  26.  
  27. CFLAGS=$(OPTS) $(CFLAG)
  28. CPP=$(CC) -E
  29. AS=as
  30.  
  31. # Assember version of bf_encrypt().
  32. BF_ENC=bf_enc.o        # normal C version
  33. #BF_ENC=asm/bx86-elf.o    # elf format x86
  34. #BF_ENC=asm/bx86-out.o    # a.out format x86
  35. #BF_ENC=asm/bx86-sol.o    # solaris format x86 
  36. #BF_ENC=asm/bx86bsdi.o    # bsdi format x86 
  37.  
  38. LIBDIR=/usr/local/lib
  39. BINDIR=/usr/local/bin
  40. INCDIR=/usr/local/include
  41. MANDIR=/usr/local/man
  42. MAN1=1
  43. MAN3=3
  44. SHELL=/bin/sh
  45. LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cbc.o bf_cfb64.o bf_ofb64.o
  46. LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cbc.c bf_cfb64.c bf_ofb64.c
  47.  
  48. GENERAL=Makefile Makefile.ssl Makefile.uni asm bf_locl.org README \
  49.     COPYRIGHT INSTALL blowfish.doc
  50.    
  51. TESTING=    bftest bfspeed
  52. TESTING_SRC=bftest.c bfspeed.c
  53. HEADERS=bf_locl.h blowfish.h bf_pi.h
  54.  
  55. ALL=    $(GENERAL) $(TESTING_SRC) $(LIBSRC) $(HEADERS)
  56.  
  57. BLIB=    libblowfish.a
  58.  
  59. all: $(BLIB) $(TESTING)
  60.  
  61. cc:
  62.     $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all
  63.  
  64. gcc:
  65.     $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all
  66.  
  67. x86-elf:
  68.     $(MAKE) BF_ENC='asm/bx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all
  69.  
  70. x86-out:
  71.     $(MAKE) BF_ENC='asm/bx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all
  72.  
  73. x86-solaris:
  74.     $(MAKE) BF_ENC='asm/bx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all
  75.  
  76. x86-bsdi:
  77.     $(MAKE) BF_ENC='asm/bx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all
  78.  
  79. # elf
  80. asm/bx86-elf.o: asm/bx86-cpp.s asm/bx86unix.cpp
  81.     $(CPP) -DELF asm/bx86unix.cpp | $(AS) -o asm/bx86-elf.o
  82.  
  83. # solaris
  84. asm/bx86-sol.o: asm/bx86-cpp.s asm/bx86unix.cpp
  85.     $(CC) -E -DSOL asm/bx86unix.cpp | sed 's/^#.*//' > asm/bx86-sol.s
  86.     as -o asm/bx86-sol.o asm/bx86-sol.s
  87.     rm -f asm/bx86-sol.s
  88.  
  89. # a.out
  90. asm/bx86-out.o: asm/bx86-cpp.s asm/bx86unix.cpp
  91.     $(CPP) -DOUT asm/bx86unix.cpp | $(AS) -o asm/bx86-out.o
  92.  
  93. # bsdi
  94. asm/bx86bsdi.o: asm/bx86-cpp.s asm/bx86unix.cpp
  95.     $(CPP) -DBSDI asm/bx86unix.cpp | $(AS) -o asm/bx86bsdi.o
  96.  
  97. test:    all
  98.     ./bftest
  99.  
  100. $(BLIB): $(LIBOBJ)
  101.     /bin/rm -f $(BLIB)
  102.     ar cr $(BLIB) $(LIBOBJ)
  103.     -if test -s /bin/ranlib; then /bin/ranlib $(BLIB); \
  104.     else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(BLIB); \
  105.     else exit 0; fi; fi
  106.  
  107. bftest: bftest.o $(BLIB)
  108.     $(CC) $(CFLAGS) -o bftest bftest.o $(BLIB)
  109.  
  110. bfspeed: bfspeed.o $(BLIB)
  111.     $(CC) $(CFLAGS) -o bfspeed bfspeed.o $(BLIB)
  112.  
  113. tags:
  114.     ctags $(TESTING_SRC) $(LIBBF)
  115.  
  116. tar:
  117.     tar chf libbf.tar $(ALL)
  118.  
  119. shar:
  120.     shar $(ALL) >libbf.shar
  121.  
  122. depend:
  123.     makedepend $(LIBBF) $(TESTING_SRC)
  124.  
  125. clean:
  126.     /bin/rm -f *.o tags core $(TESTING) $(BLIB) .nfs* *.old *.bak asm/*.o 
  127.  
  128. dclean:
  129.     sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new
  130.     mv -f Makefile.new Makefile
  131.  
  132. # Eric is probably going to choke when he next looks at this --tjh
  133. install: $(BLIB)
  134.     if test $(INSTALLTOP); then \
  135.         echo SSL style install; \
  136.         cp $(BLIB) $(INSTALLTOP)/lib; \
  137.         if test -s /bin/ranlib; then \
  138.             /bin/ranlib $(INSTALLTOP)/lib/$(BLIB); \
  139.         else \
  140.         if test -s /usr/bin/ranlib; then \
  141.         /usr/bin/ranlib $(INSTALLTOP)/lib/$(BLIB); \
  142.         fi; fi; \
  143.         chmod 644 $(INSTALLTOP)/lib/$(BLIB); \
  144.         cp blowfish.h $(INSTALLTOP)/include; \
  145.         chmod 644 $(INSTALLTOP)/include/blowfish.h; \
  146.     else \
  147.         echo Standalone install; \
  148.         cp $(BLIB) $(LIBDIR)/$(BLIB); \
  149.         if test -s /bin/ranlib; then \
  150.           /bin/ranlib $(LIBDIR)/$(BLIB); \
  151.         else \
  152.           if test -s /usr/bin/ranlib; then \
  153.         /usr/bin/ranlib $(LIBDIR)/$(BLIB); \
  154.           fi; \
  155.         fi; \
  156.         chmod 644 $(LIBDIR)/$(BLIB); \
  157.         cp blowfish.h $(INCDIR)/blowfish.h; \
  158.         chmod 644 $(INCDIR)/blowfish.h; \
  159.     fi
  160. # DO NOT DELETE THIS LINE -- make depend depends on it.
  161.